﻿<%@ Page Language="C#" MasterPageFile="~/admin/AdminMaster.master" AutoEventWireup="true"
    StylesheetTheme="Skin1" CodeBehind="Users.aspx.cs" Inherits="MLY.ADMIN.Users"
    Title='<%$Dict:Users.Title%>' %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="mainContent" runat="server">
    <table border="0" cellspacing="0" style=" width:100%;">
        <tr>
            <td colspan="2">
                <asp:GridView ID="GridView1" runat="server" DataSourceID="ObjectDataSource1" HeaderStyle-Height="30"
                    SkinID="GridViewSkin" AllowSorting="True">
                    <Columns>
                        <asp:TemplateField HeaderStyle-CssClass="dottedLineRightHeader">
                            <ItemTemplate>
                                <asp:ImageButton ID="btnDelete" runat="server" CommandArgument='<%# Eval("UserId") %>'
                                    ImageUrl="~/Images/Cancel.gif" ToolTip="Delete User " OnClick="btnDelete_Click" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderStyle-CssClass="dottedLineRightHeader">
                            <HeaderTemplate>
                                <asp:HyperLink ID="HyperLink3" runat="server" ImageUrl="~/Images/Add.png" NavigateUrl="UserCard.aspx?UserId=new">Add New User</asp:HyperLink>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="<%#String.Format(&quot;UserCard.aspx?UserId={0}&quot;,Eval(&quot;UserId&quot;)) %>">
                    <img src="../../../Images/Magnifier.png" alt="Edit User" style="border-style: none" />
                                </asp:HyperLink>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="UserId" HeaderStyle-CssClass="dottedLineRightHeader" HeaderText="UserId" SortExpression="UserId" Visible="False" />
                        <asp:BoundField DataField="UserName" HeaderStyle-CssClass="dottedLineRightHeader" HeaderText="UserName" SortExpression="UserName" />
                        <asp:BoundField DataField="FullName" HeaderStyle-CssClass="dottedLineRightHeader" HeaderText="FullName" SortExpression="FullName" />
                        <asp:BoundField DataField="Password" HeaderStyle-CssClass="dottedLineRightHeader" HeaderText="Password" SortExpression="Password"
                            Visible="False" />
                        <asp:BoundField DataField="LastLogin" HeaderStyle-CssClass="dottedLineRightHeader" HeaderText="LastLogin" SortExpression="LastLogin"
                            Visible="False" />
                        <asp:TemplateField HeaderText="Organiztion" HeaderStyle-CssClass="dottedLineRightHeader" SortExpression="OrganiztionId">
                            <EditItemTemplate>
                                <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("OrganiztionId") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="linqOrgDataSource"
                                    DataTextField="OrganizationName" DataValueField="OrganizationId" Enabled="False"
                                    SelectedValue='<%# Bind("OrganiztionId") %>'>
                                </asp:DropDownList>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Role" HeaderStyle-CssClass="dottedLineRightHeader"   SortExpression="RollId">
                            <EditItemTemplate>
                                <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("RollId") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:DropDownList ID="DropDownList2" runat="server"  DataSourceID="linqRollsDataSource"
                                    DataTextField="RollDescription" DataValueField="RollId" Enabled="False" SelectedValue='<%# Bind("RollId") %>'>
                                </asp:DropDownList>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="Email" HeaderStyle-CssClass="dottedLineRightHeader" HeaderText="Email" SortExpression="Email" Visible="False" />
                        <asp:BoundField DataField="Phone" HeaderStyle-CssClass="dottedLineRightHeader" HeaderText="Phone" SortExpression="Phone" Visible="False" />
                        <asp:BoundField DataField="Address" HeaderStyle-CssClass="dottedLineRightHeader" HeaderText="Address" SortExpression="Address"
                            Visible="False" />
                        <asp:BoundField DataField="Culture" HeaderStyle-CssClass="dottedLineRightHeader" HeaderText="Culture" SortExpression="Culture"
                            Visible="False" />
                        <asp:BoundField DataField="DefaultLinesinGrid" HeaderStyle-CssClass="dottedLineRightHeader" HeaderText="DefaultLinesinGrid" SortExpression="DefaultLinesinGrid"
                            Visible="False" />
                        <asp:BoundField DataField="UpdateDate" HeaderStyle-CssClass="dottedLineRightHeader" HeaderText="UpdateDate" SortExpression="UpdateDate"
                            Visible="False" />
                        <asp:BoundField DataField="DateCreated" HeaderStyle-CssClass="dottedLineRightHeader" HeaderText="DateCreated" SortExpression="DateCreated"
                            Visible="False" />
                        <asp:BoundField DataField="UpdateBy" HeaderText="UpdateBy" SortExpression="UpdateBy"
                            Visible="False" />
                    </Columns>
                </asp:GridView>
                <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" OldValuesParameterFormatString="original_{0}"
                    SelectMethod="GetUsers" TypeName="MLY.Bll.clsUser" DeleteMethod="DeleteUser">
                    <DeleteParameters>
                        <asp:Parameter Name="UserId" Type="Int32" />
                    </DeleteParameters>
                </asp:ObjectDataSource>
                <asp:LinqDataSource runat="server" ID="linqOrgDataSource" ContextTypeName="MLY.Dal.lqKbmDataContext"
                    Select="new (OrganizationId, OrganizationName)" TableName="TableOrganizations">
                </asp:LinqDataSource>
                <asp:LinqDataSource ID="linqRollsDataSource" runat="server" ContextTypeName="MLY.Dal.lqLookupsDataContext"
                    TableName="LookupRolls">
                </asp:LinqDataSource>
            </td>
        </tr>
    </table>
</asp:Content>
